package com.pctx.bibaregisterlogin.service.impl;

import com.pctx.bibacommon.result.Result;
import com.pctx.bibaregisterlogin.dao.CompanyMapper;
import com.pctx.bibaregisterlogin.dao.DepartmentMapper;
import com.pctx.bibaregisterlogin.dao.PositionMapper;
import com.pctx.bibaregisterlogin.dao.UserMapper;
import com.pctx.bibaregisterlogin.pojo.Company;
import com.pctx.bibaregisterlogin.pojo.Department;
import com.pctx.bibaregisterlogin.pojo.Position;
import com.pctx.bibaregisterlogin.pojo.User;
import com.pctx.bibaregisterlogin.service.MyCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("myCenterService")
public class MyCenterServiceImpl implements MyCenterService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private CompanyMapper companyMapper;
    @Autowired
    private DepartmentMapper departmentMapper;
    @Autowired
    private PositionMapper positionMapper;
    @Override
    public Result personalMessage(String username) throws Exception {
        User user=userMapper.selectByUsername(username);
       Company company=companyMapper.selectByUuid(user.getCompanyUuid());
        Department department=departmentMapper.selectByUuid(user.getDepartmentUuid());
        Position position=positionMapper.selectByUuid(user.getPositionUuid());
        user.setDepartment(department);
      //  user.setCompany(company);
        user.setPosition(position);
        return Result.success(company,"成功");
    }

    /*@Override
    public Result companyMessage(String uuid) throws Exception {
        Company company=companyMapper.selectByUuid(uuid);

        return Result.success(company);
    }*/
}
